#include "hccompiler.h"
#include "hcsrcobj.h"
#include "stdio.h"
#include "stdlib.h"

extern FILE* hcin;

const int CODE = 1;

int hccompiler_compile(hcsrcobj* src)
{
    switch(src->type)
    {
        case 1: // CODE
        {
            hcin = fopen(src->filename->text, "r");
            if(0 != hcin) {
                int parser = hcparse();
                return parser;
            }
            else
            {
                return -1;
            }
            break;
        }
        case 2: // LIB
        {
            return 0;
            break;
        }
        case 0: // INVALID
        {
            return 1;
            break;
        }
        default:
            return 1;
    }
}

